<template>
  <div class="content">
    <div class="content-dv">
      <div class="loading-pop" id="progress">下载中...</div>
      <div class="head">
        <div class="head-logo" @click="jump('index')"></div>
        <div class="head-left">
          <div class="btn-item" @click="jump('index')">
            <div class="btn-item-icon roam-icon"></div>
            <div class="btn-item-text">返回首页</div>
          </div>
          <div class="btn-item" @click="sceneInit">
            <div class="btn-item-icon scene-icon"></div>
            <div class="btn-item-text">重置场景</div>
          </div>
        </div>
        <div class="head-right">
          <div>{{ dateObj.date }}</div>
          <div>{{ dateObj.week }}</div>
          <div style="color: white">{{ dateObj.time }}</div>
        </div>
        <div class="head-dv">
          <div class="category-item" @click="jump('bdz')">
            炼铁2#110kV变电站
          </div>
          <div class="category-item" @click="jump('zh')">10kV综合配电室</div>
          <div class="category-item" @click="jump('kjc')">
            3#高炉矿焦槽及供料10kV配电室
          </div>
          <div class="category-item" @click="jump('gl')">3#高炉本体配电室</div>
          <div class="category-item category-active">3#高炉C1渣处理配电室</div>
        </div>
      </div>
      <div class="left">
        <div v-if="menuId == 0">
          <div class="title-item">
            <div class="title-item-text">重点设备监测</div>
            <div class="title-item-en">/ Key equipment monitoring</div>
          </div>
          <div class="zsb-dv">
            <div class="zsb-item" :key="i" v-for="(item, i) in sbjcLists">
              <div class="zsb-title">
                {{ item.name }}
              </div>
              <div class="zsb-value">{{ item.val }}</div>
            </div>
          </div>
        </div>
        <div style="height: 3rem" v-if="menuId == 0">
          <div class="title-item mt-1">
            <div class="title-item-text">主接线图</div>
            <div class="title-item-en">/ Main wiring diagram</div>
          </div>
          <el-image
            class="img-dv"
            fit="fill"
            lazy
            src="../../static/images/c1.png"
            :preview-src-list="['../../static/images/c1.png']"
          >
          </el-image>
        </div>
        <div v-if="menuId == 0">
          <div class="title-item mt-1">
            <div class="title-item-text">报警列表</div>
            <div class="title-item-en">/ Alarm List</div>
          </div>
          <div class="warn-dv">
            <div class="warn-item">
              <div class="warn-icon"></div>
              <div class="warn-title">主区域 1#变电器异常</div>
              <div class="warn-time">2024-11-20 10:20:30</div>
            </div>
            <div class="warn-item">
              <div class="warn-icon1"></div>
              <div class="warn-title">主区域 1#变电器异常</div>
              <div class="warn-time">2024-11-20 10:20:30</div>
            </div>
            <div class="warn-item">
              <div class="warn-icon2"></div>
              <div class="warn-title">主区域 1#变电器异常</div>
              <div class="warn-time">2024-11-20 10:20:30</div>
            </div>
            <div class="warn-item">
              <div class="warn-icon"></div>
              <div class="warn-title">主区域 1#变电器异常</div>
              <div class="warn-time">2024-11-20 10:20:30</div>
            </div>
            <div class="warn-item">
              <div class="warn-icon2"></div>
              <div class="warn-title">主区域 1#变电器异常</div>
              <div class="warn-time">2024-11-20 10:20:30</div>
            </div>
          </div>
        </div>
        <div v-if="menuId == 1">
          <div class="title-item">
            <div class="title-item-text">设备列表</div>
            <div class="title-item-en">/ Device List</div>
          </div>
          <div class="sb-content">
            <div :key="i" v-for="(sb, i) in sbObj.lists">
              <div class="sb-item" @click="changeSb(sb)">
                <div
                  class="sb-item-icon"
                  :class="{ 'sb-item-active': sbObj.pid == sb.id }"
                ></div>
                <div class="sb-item-text">{{ sb.name }}</div>
              </div>
              <div class="sb-item-dv" v-if="sbObj.pid == sb.id">
                <div
                  class="sb-item-content"
                  :key="index"
                  v-for="(item, index) in sb.itemLists"
                >
                  <div
                    class="sb-item-name"
                    @click="changeSb(item, false)"
                    :class="{ 'sb-active': sbObj.id == item.id }"
                  >
                    {{ item.name }}
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div v-if="menuId == 3">
          <div class="title-item">
            <div class="title-item-text">监控列表</div>
            <div class="title-item-en">/ Monitoring List</div>
          </div>
          <div class="monitor-content">
            <div
              class="monitor-item"
              :class="{ 'monitor-active': MonitorObj.id == item.id }"
              :key="i"
              v-for="(item, i) in MonitorObj.lists"
              @click="changeMonitor(item)"
            >
              <div class="monitor-item-text">{{ item.name }}</div>
            </div>
          </div>
        </div>
      </div>
      <div id="container"></div>
      <div class="right">
        <div v-if="menuId == 0">
          <div class="title-item">
            <div class="title-item-text">环境监测</div>
            <div class="title-item-en">/ environmental monitoring</div>
          </div>
          <div class="env-dv">
            <div class="env-dv-left">
              <div class="env-item">
                <div class="env-icon"></div>
                <div class="env-content">
                  <div>磁感应强度(v/m)</div>
                  <div class="env-num">100</div>
                </div>
              </div>
              <div class="env-item" style="margin-top: 0.12rem">
                <div class="env-icon zy-icon"></div>
                <div class="env-content">
                  <div>变电站噪音(dB)</div>
                  <div class="env-num">52</div>
                </div>
              </div>
            </div>
            <div class="env-dv-right">
              <div class="env-right-item">
                <div class="env-right-icon wd-icon"></div>
                <div class="env-right-content">
                  温度
                  <p class="env-right-val"><span>25</span>℃</p>
                </div>
              </div>
              <div class="env-right-item mt-1">
                <div class="env-right-icon sd-icon"></div>
                <div class="env-right-content">
                  湿度
                  <p class="env-right-val"><span>30</span>%</p>
                </div>
              </div>
              <div class="env-right-item mt-1">
                <div class="env-right-icon fl-icon"></div>
                <div class="env-right-content">
                  风速
                  <p class="env-right-val"><span>0.6</span>m/s</p>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div v-if="menuId == 0">
          <div class="title-item mt-1">
            <div class="title-item-text">主变电流</div>
            <div class="title-item-en">/ Main transformer current</div>
          </div>
          <div class="zbdl-dv">
            <div class="zbdl-top">
              <div
                class="zbdl-top-item"
                :class="{ 'zbdl-actived': chartsObj.id1 == 1 }"
                @click="tabZBDL(1)"
              >
                1#主变
              </div>
              <div
                class="zbdl-top-item"
                :class="{ 'zbdl-actived': chartsObj.id1 == 2 }"
                @click="tabZBDL(2)"
              >
                2#主变
              </div>
              <div
                class="zbdl-top-item"
                :class="{ 'zbdl-actived': chartsObj.id1 == 3 }"
                @click="tabZBDL(3)"
              >
                3#主变
              </div>
            </div>
            <div id="zbdl"></div>
          </div>
        </div>
        <div v-if="menuId == 0">
          <div class="title-item mt-1">
            <div class="title-item-text">进线功率</div>
            <div class="title-item-en">/ Incoming power</div>
          </div>
          <div class="zbdl-dv">
            <div class="zbdl-top">
              <div
                class="zbdl-top-item"
                :class="{ 'zbdl-actived': chartsObj.id2 == 30 }"
                @click="tabJXGL(30)"
              >
                1#进线
              </div>
              <div
                class="zbdl-top-item"
                :class="{ 'zbdl-actived': chartsObj.id2 == 31 }"
                @click="tabJXGL(31)"
              >
                2#进线
              </div>
              <div
                class="zbdl-top-item"
                :class="{ 'zbdl-actived': chartsObj.id2 == 32 }"
                @click="tabJXGL(32)"
              >
                联络线
              </div>
            </div>
            <div id="jxgl"></div>
          </div>
        </div>
        <div v-if="sbObj.id">
          <div class="title-item">
            <div class="sb-title-text">{{ sbObj.title }}</div>
          </div>
          <div class="sb-info" v-if="sbObj.infos.length != 0">
            <div class="sb-info-item" :key="i" v-for="(item, i) in sbObj.infos">
              <div class="sb-info-title">{{ item.name }}</div>
              <div class="sb-info-value">{{ item.val }}</div>
              <div class="sb-info-unit">{{ item.unit }}</div>
            </div>
          </div>
          <div class="sb-info no-sb" v-if="sbObj.infos.length == 0">
            暂无点位接入
          </div>
        </div>
        <div v-if="MonitorObj.id">
          <div class="title-item">
            <div class="title-item-text">实时监控</div>
            <div class="title-item-en">/ Real-time Monitoring</div>
          </div>
          <div class="monitor-right-content">
            <div class="monitor-video"></div>
          </div>
        </div>
      </div>
      <div class="foot">
        <div class="alarm" v-if="menuId == 2">
          <div class="title-item alarm-bg">
            <div class="title-item-text">今日告警</div>
            <div class="title-item-en">/ Today's alarm</div>
          </div>
          <div class="alarm-dv">
            <div class="alarm-item" style="color: #91befe">
              <div class="alarm-title0"></div>
              <div class="alarm-title1">严重性</div>
              <div class="alarm-title2"></div>
              <div class="alarm-title3">进入报警时间</div>
              <div class="alarm-title4">离开报警时间</div>
              <div class="alarm-title5">报警名称</div>
              <div class="alarm-title6">信息</div>
            </div>
            <div class="alarm-dv-content">
              <div class="alarm-item">
                <div class="alarm-title0"></div>
                <div class="alarm-title1">250</div>
                <div class="alarm-blue"></div>
                <div class="alarm-title3">2024.08.28 12:20:15</div>
                <div class="alarm-title4">2024.08.28 15:20:15</div>
                <div class="alarm-title5">C102 01 Bin38dV VC CISLS FB</div>
                <div class="alarm-title6">
                  2#喷吹系统 气压泄露报警 气压泄露报警
                </div>
              </div>
              <div class="alarm-item alarm-item-actived">
                <div class="alarm-title0"></div>
                <div class="alarm-title1">250</div>
                <div class="alarm-red"></div>
                <div class="alarm-title3">2024.08.28 12:20:15</div>
                <div class="alarm-title4">2024.08.28 15:20:15</div>
                <div class="alarm-title5">C102 01 Bin38dV VC CISLS FB</div>
                <div class="alarm-title6">
                  2#喷吹系统 气压泄露报警 气压泄露报警
                </div>
              </div>
              <div class="alarm-item">
                <div class="alarm-title0"></div>
                <div class="alarm-title1">250</div>
                <div class="alarm-red"></div>
                <div class="alarm-title3">2024.08.28 12:20:15</div>
                <div class="alarm-title4">2024.08.28 15:20:15</div>
                <div class="alarm-title5">C102 01 Bin38dV VC CISLS FB</div>
                <div class="alarm-title6">
                  2#喷吹系统 气压泄露报警 气压泄露报警
                </div>
              </div>
              <div class="alarm-item alarm-item-actived">
                <div class="alarm-title0"></div>
                <div class="alarm-title1">250</div>
                <div class="alarm-blue"></div>
                <div class="alarm-title3">2024.08.28 12:20:15</div>
                <div class="alarm-title4">2024.08.28 15:20:15</div>
                <div class="alarm-title5">C102 01 Bin38dV VC CISLS FB</div>
                <div class="alarm-title6">
                  2#喷吹系统 气压泄露报警 气压泄露报警
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="foot-dv">中冶华天工程技术有限公司钢铁设计研究总院V1.0</div>
        <div
          class="menu-item"
          :class="{ 'menu-active': i == menuId }"
          :key="i"
          v-for="(menu, i) in ['综合展示', '设备管理', '告警管理', '安防联动']"
          @click="changeMenu(i)"
        >
          <div class="menu-item-icon" :class="'icon' + i"></div>
          <div class="menu-item-text">{{ menu }}</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import c1Class from "../js/home.js";
import _c1Config from "../js/c1Config.js";
import { getPointDatas } from "../js/api.js";
import * as echarts from "echarts";
import * as mqtt from "mqtt";
let _timer = null,
  _myCharts = {},
  _mqttClient = null,
  _c1Main = null;
export default {
  name: "c1",
  data() {
    return {
      menuId: 0,
      dateObj: {
        date: "",
        week: "",
        time: "",
      },
      sbjcLists: [],
      sbObj: { pid: 0, id: 0, title: "", lists: [], infos: [] },
      MonitorObj: { id: 0, lists: [] },
      chartsObj: { id1: 0, id2: 0 },
    };
  },
  mounted() {
    _c1Main = new c1Class();
    window.addEventListener("beforeunload", this.handleBeforeUnload);
    _c1Main.initModel("c1").then((res) => {
      this.initPage();
    });
  },
  methods: {
    initPage() {
      this.getNowdate();
      this.chartShow();
      _timer = setInterval(this.getNowTime, 1000);
      this.sbjcLists = _c1Config.sbjcLists;
      this.sbObj.lists = _c1Config.sbLists;
      this.MonitorObj.lists = _c1Config.MonitorLists;
      this.mqtt();
    },
    mqtt() {
      _mqttClient = mqtt.connect(_c1Config.mqttObj.url, {
        username: _c1Config.mqttObj.name,
        password: _c1Config.mqttObj.pwd,
      });
      _mqttClient.on("connect", (connack) => {
        _mqttClient.subscribe("BF3-2Sub", { qos: 1 });
      });
      _mqttClient.on("message", (topic, message) => {
        let jsonObj = JSON.parse(message.toString());
        this.doData(jsonObj.values);
      });
    },
    doData(arrs) {
      if (this.menuId == 1) {
        if (this.sbObj.id != 0) {
          this.doProcessData(this.sbObj.infos, arrs);
        }
      }
    },
    doProcessData(data, arrs) {
      const _doData = (_datas, _arrs) => {
        _datas.forEach((child) => {
          _arrs.some((item) => {
            if (child.mqtt_id == item.id) {
              child.val = (+item.v).toFixed(2);
              return true;
            }
          });
        });
      };
      _doData(data, arrs);
    },
    tabZBDL(id) {
      if (this.chartsObj.id1 != id) {
        this.chartsObj.id1 = id;
        let currentDate = new Date();
        let oneHoursAgo = new Date(currentDate.getTime() - 1 * 60 * 60 * 1000);
        let st = this.formatDate(oneHoursAgo),
          et = this.formatDate(currentDate);
        this.$nextTick(() => {
          this.initChart("zbdl");
        });
        const ids = [[], [21, 22, 23], [24, 25, 26], [27, 28, 29]];
        const requests = ids[id].map((id) => getPointDatas({ id, st, et }));
        Promise.all(requests)
          .then((resArray) => {
            this.doChartDatas(1, resArray);
          })
          .catch((error) => {
            this.$message({
              message: "暂未查到历史点位数据!",
              type: "error",
              duration: 6000,
            });
            this.doChartDatas(1, [[], [], [], []]);
          });
      }
    },
    tabJXGL(id) {
      if (this.chartsObj.id2 != id) {
        this.chartsObj.id2 = id;
        let currentDate = new Date();
        let oneHoursAgo = new Date(currentDate.getTime() - 1 * 60 * 60 * 1000);
        let that = this,
          tempObj = {
            id: id,
            st: this.formatDate(oneHoursAgo),
            et: this.formatDate(currentDate),
          };
        that.$nextTick(() => {
          that.initChart("jxgl");
        });
        getPointDatas(tempObj)
          .then((res) => {
            if (res.length > 0) {
              if (
                res[0].pointValue == -1 &&
                res[res.length - 1].pointValue == -1
              ) {
                this.$message({
                  message: "暂未查到历史点位数据!",
                  type: "error",
                  duration: 6000,
                });
                that.doChartDatas(2, []);
              } else {
                that.doChartDatas(2, res);
              }
            }
          })
          .catch((error) => {
            this.$message({
              message: "暂未查到历史点位数据!",
              type: "error",
              duration: 6000,
            });
            this.doChartDatas(2, []);
          });
      }
    },
    doChartDatas(type, datas) {
      if (type == 1) {
        const timestamps = datas[0].map((item) => item.ts);
        const values = datas.map((group) =>
          group.map((item) => item.pointValue)
        );
        let obj = {
          name: "zbdl",
          color: ["#FFAC26", "#3AB5FF", "#F2021F"],
          times: timestamps,
          series: [
            {
              name: "A相电流la",
              type: "line",
              data: values[0],
            },
            {
              name: "B相电流lb",
              type: "line",
              data: values[1],
            },
            {
              name: "C相电流lc",
              type: "line",
              data: values[2],
            },
          ],
        };
        this.updateChart(obj);
      } else {
        let obj = {
          name: "jxgl",
          color: ["#3AB5FF"],
          times: [],
          series: [
            {
              areaStyle: {
                color: {
                  type: "linear",
                  x: 0,
                  y: 0,
                  x2: 0,
                  y2: 1,
                  colorStops: [
                    {
                      offset: 1,
                      color: "rgba(23,192,236,0.05)",
                    },
                    {
                      offset: 0,
                      color: "rgba(23,192,236,0.8)",
                    },
                  ],
                },
              },
              type: "line",
              smooth: true,
              data: [],
            },
          ],
        };
        datas.forEach((data) => {
          obj.times.push(data.ts);
          obj.series[0].data.push(data.pointValue);
        });
        this.updateChart(obj);
      }
    },
    formatDate(time) {
      let date = new Date(time);
      const year = date.getFullYear();
      const month = String(date.getMonth() + 1).padStart(2, "0");
      const day = String(date.getDate()).padStart(2, "0");
      const hours = String(date.getHours()).padStart(2, "0");
      const minutes = String(date.getMinutes()).padStart(2, "0");
      const seconds = String(date.getSeconds()).padStart(2, "0");
      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    },
    initChart(name) {
      if (!_myCharts[name]) {
        _myCharts[name] = echarts.init(document.getElementById(name));
        _myCharts[name].setOption({
          tooltip: {
            trigger: "axis",
            axisPointer: {
              type: "cross",
              label: {
                backgroundColor: "#6a7985",
              },
            },
          },
          grid: {
            top: "6%",
            left: "3%",
            right: "6%",
            bottom: "3%",
            containLabel: true,
          },
          xAxis: {
            type: "category",
            boundaryGap: false,
            axisLabel: {
              textStyle: {
                color: "#ffffff",
              },
            },
            data: ["00.00", "01.00", "02.00", "03.00", "04.00"],
            axisLine: {
              show: false,
            },
          },
          yAxis: {
            type: "value",
            axisLine: {
              show: false,
            },
            axisLabel: {
              textStyle: {
                color: "#ffffff",
              },
            },
            splitLine: {
              lineStyle: {
                color: "#263a55",
              },
            },
          },
        });
      }
      _myCharts[name].showLoading({
        color: "#fff",
        textColor: "#fff",
        maskColor: "rgba(0,0,0,0.1)",
      });
    },
    updateChart(obj) {
      _myCharts[obj.name].hideLoading();
      _myCharts[obj.name].setOption({
        color: obj.color,
        xAxis: {
          data: obj.times,
        },
        series: obj.series,
      });
    },
    chartShow() {
      this.tabZBDL(1);
      this.tabJXGL(30);
    },
    sceneInit() {
      _c1Main.sceneInit();
    },
    changeMonitor(obj) {
      if (this.MonitorObj.id != obj.id) {
        this.MonitorObj.id = obj.id;
        _c1Main.changeCameras(obj);
      }
    },
    changeSb(obj, isPid = true) {
      if (isPid) {
        if (this.sbObj.pid != obj.id) {
          this.sbObj.pid = obj.id;
          this.sbObj.id = 0;
        } else {
          this.sbObj.pid = 0;
          this.sbObj.id = 0;
        }
      } else {
        if (this.sbObj.id != obj.id) {
          _c1Main.positionModel(obj);
          this.sbObj.id = obj.id;
          this.sbObj.title = obj.name;
          this.sbObj.infos = _c1Config.sbInfos[obj.id];
        }
      }
    },
    changeMenu(id) {
      if (this.menuId != id) {
        if (this.menuId == 0) {
          for (let key in _myCharts) {
            if (_myCharts[key]) {
              _myCharts[key].dispose();
              _myCharts[key] = null;
            }
          }
        } else if (this.menuId == 1) {
          this.sbObj.pid = 0;
          this.sbObj.id = 0;
          this.sbObj.title = "";
          this.sbObj.infos = [];
          _c1Main.doClipPlane();
        } else if (this.menuId == 3) {
          this.MonitorObj.id = 0;
          _c1Main.changeCameras({}, false);
        }
        this.menuId = id;
        if (id == 0) {
          this.$nextTick(() => {
            this.chartShow();
          });
        } else if (id == 1) {
          _c1Main.doClipPlane();
        } else if (id == 3) {
          _c1Main.makeCameras(_c1Config.MonitorLists);
        }
      }
    },
    jump(name) {
      this.$router.push({ name });
    },
    handleBeforeUnload() {
      if (_timer) {
        clearInterval(_timer);
        _timer = null;
      }
      if (_mqttClient) {
        _mqttClient.end();
        _mqttClient = null;
      }
      for (let key in _myCharts) {
        if (_myCharts[key]) {
          _myCharts[key].dispose();
          _myCharts[key] = null;
        }
      }
      _c1Main.destroy();
    },
    getNowTime() {
      var date = new Date();
      var hour = date.getHours();
      var minutes = date.getMinutes();
      var seconds = date.getSeconds();
      hour = hour < 10 ? "0" + hour : hour;
      minutes = minutes < 10 ? "0" + minutes : minutes;
      seconds = seconds < 10 ? "0" + seconds : seconds;
      if (hour == "00" && minutes == "00" && seconds == "05") {
        this.getNowdate();
      }
      this.dateObj.time = hour + ":" + minutes + ":" + seconds;
    },
    getNowdate() {
      const currentDate = new Date();
      const year = currentDate.getFullYear();
      const month = String(currentDate.getMonth() + 1).padStart(2, "0");
      const day = String(currentDate.getDate()).padStart(2, "0");
      this.dateObj.date = `${year}.${month}.${day}`;
      var weekArr = [
        "星期日",
        "星期一",
        "星期二",
        "星期三",
        "星期四",
        "星期五",
        "星期六",
      ];
      this.dateObj.week = weekArr[currentDate.getDay()];
    },
  },
  beforeDestroy() {
    this.handleBeforeUnload();
  },
};
</script>

<style scoped>
.content {
  width: 100vw;
  height: 100vh;
  background: url("../../static/images/bg.png") no-repeat;
  background-size: 100% 100%;
}
.content-dv {
  width: 100vw;
  height: 100vh;
  position: relative;
  background: url("../../static/images/bg-mask.png") no-repeat;
  background-size: 100% 100%;
}
.loading-pop {
  z-index: 999999;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.2rem;
  font-weight: bold;
  color: white;
}
.head {
  position: absolute;
  top: 0;
  right: 0.02rem;
  left: 0.02rem;
  z-index: 99;
  width: 19.16rem;
  height: 0.75rem;
  background: url("../../static/images/logo_bg.png") no-repeat;
  background-size: 100% 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.head-logo {
  width: 8.05rem;
  height: 0.41rem;
  background: url("../../static/images/logo1.png") no-repeat;
  background-size: 100% 100%;
  cursor: pointer;
}
.head-left {
  position: absolute;
  top: 0.32rem;
  left: 0.3rem;
  z-index: 999;
  width: 2.7rem;
  height: 0.4rem;
  display: flex;
  justify-content: space-between;
}
.btn-item {
  width: 1.3rem;
  height: 0.4rem;
  display: flex;
  justify-content: center;
  align-items: center;
  background: url("../../static/images/button.png") no-repeat;
  background-size: 100% 100%;
  cursor: pointer;
}
.btn-item-icon {
  width: 0.2rem;
  height: 0.2rem;
  margin-right: 0.1rem;
}
.roam-icon {
  background: url("../../static/images/zdmy.png") no-repeat;
  background-size: 100% 100%;
}
.scene-icon {
  background: url("../../static/images/czcj.png") no-repeat;
  background-size: 100% 100%;
}
.btn-item-text {
  font-size: 0.18rem;
  color: white;
}
.head-right {
  position: absolute;
  top: 0.35rem;
  right: 0.32rem;
  z-index: 999;
  width: 2.8rem;
  height: 0.3rem;
  line-height: 0.3rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.18rem;
  color: #91befe;
}
.head-dv {
  position: absolute;
  top: 0.82rem;
  left: 50%;
  z-index: 999;
  transform: translateX(-50%);
  width: 10.2rem;
  height: 0.4rem;
  z-index: 9999;
  display: flex;
  justify-content: space-between;
}
.category-item {
  width: 2rem;
  height: 0.4rem;
  line-height: 0.4rem;
  font-size: 0.13rem;
  font-weight: bold;
  font-style: oblique;
  color: white;
  background: url("../../static/images/category.png") no-repeat;
  background-size: 100% 100%;
  cursor: pointer;
  text-align: center;
}
.category-active {
  background: url("../../static/images/category_a.png") no-repeat;
  background-size: 100% 100%;
  cursor: default;
}
.left {
  position: absolute;
  top: 0.9rem;
  left: 0.1rem;
  z-index: 999;
  width: 3.2rem;
}
.title-item {
  width: 3.2rem;
  height: 0.32rem;
  line-height: 0.32rem;
  background: url("../../static/images/title_bg.png") no-repeat;
  background-size: 100% 100%;
  display: flex;
}
.mt-1 {
  margin-top: 0.05rem;
}
.sb-title-text {
  font-family: "PM-FONT";
  width: 2.9rem;
  font-size: 0.18rem;
  color: white;
  margin-left: 0.3rem;
}
.title-item-text {
  font-family: "PM-FONT";
  max-width: 2rem;
  font-size: 0.18rem;
  color: white;
  margin-left: 0.35rem;
}
.title-item-en {
  margin-left: 0.1rem;
  font-size: 0.12rem;
  color: #4882d8;
}
.zsb-dv {
  width: 3.2rem;
  max-height: 2.5rem;
  overflow: auto;
  background: rgba(33, 64, 105, 0.6);
}
.zsb-item {
  width: 3.1rem;
  height: 0.2rem;
  line-height: 0.2rem;
  margin: 0.1rem 0.05rem 0;
  font-size: 0.14rem;
  color: white;
  display: flex;
  border-bottom: 1px dashed #1b5b95;
}
.zsb-title {
  width: 2.6rem;
  margin-right: 0.03rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.zsb-value {
  width: 0.7rem;
  text-align: right;
  color: #ffc60c;
}
.img-dv {
  width: 3.2rem;
  height: 2.5rem;
  margin-top: 0.1rem;
  opacity: 0.5;
}
.warn-dv {
  width: 3.2rem;
  max-height: 2.05rem;
  overflow: auto;
  background: rgba(33, 64, 105, 0.6);
}
.warn-item {
  width: 3.2rem;
  height: 0.5rem;
  font-size: 0.13rem;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.warn-item:nth-child(2n) {
  background: url("../../static/images/warn_bg.png");
  background-repeat: repeat-x;
}
.warn-icon {
  margin: 0 0.05rem;
  width: 0.36rem;
  height: 0.2rem;
  background: url("../../static/images/warn3.png") no-repeat;
  background-size: 100% 100%;
}
.warn-icon1 {
  margin: 0 0.05rem;
  width: 0.36rem;
  height: 0.2rem;
  background: url("../../static/images/warn1.png") no-repeat;
  background-size: 100% 100%;
}
.warn-icon2 {
  margin: 0 0.05rem;
  width: 0.36rem;
  height: 0.2rem;
  background: url("../../static/images/warn2.png") no-repeat;
  background-size: 100% 100%;
}
.warn-title {
  width: 1.5rem;
}
.warn-time {
  width: 1.1rem;
  font-size: 0.1rem;
}
.sb-content {
  max-height: 7.8rem;
  overflow-y: auto;
  animation: fadeIn 2s;
}
.sb-item {
  width: 3rem;
  height: 0.36rem;
  margin: 0.15rem 0 0.05rem 0.1rem;
  display: flex;
  align-items: center;
  background: url("../../static/images/sb_bg.png") no-repeat;
  background-size: 100% 100%;
  cursor: pointer;
}
.sb-item-icon {
  width: 0.22rem;
  height: 0.22rem;
  margin-left: 0.05rem;
  margin-right: 0.13rem;
  background: url("../../static/images/close.png") no-repeat;
  background-size: 100% 100%;
}
.sb-item-active {
  background: url("../../static/images/open.png") no-repeat;
  background-size: 100% 100%;
}
.sb-item-text {
  line-height: 0.36rem;
  font-size: 0.16rem;
  color: white;
}
.sb-item-dv {
  max-height: 4rem;
  overflow-y: auto;
}
.sb-item-content {
  width: 3rem;
  margin-left: 0.1rem;
  background: rgba(30, 56, 97, 0.3);
}
.sb-item-name {
  line-height: 0.36rem;
  font-size: 0.15rem;
  color: white;
  padding-left: 0.4rem;
  cursor: pointer;
}
.sb-active {
  background: url("../../static/images/sb_a.png") no-repeat;
  background-size: 2.9rem 0.36rem;
  background-position: 0.05rem;
}
.monitor-content {
  max-height: 7.5rem;
  overflow-y: auto;
  padding-bottom: 0.18rem;
  background: rgba(30, 56, 97, 0.3);
}
.monitor-item {
  width: 3rem;
  height: 0.36rem;
  margin-left: 0.1rem;
  margin-top: 0.18rem;
  background: url("../../static/images/sb_bg.png") no-repeat;
  background-size: 100% 100%;
  line-height: 0.36rem;
  font-size: 0.16rem;
  color: white;
  cursor: pointer;
}
.monitor-active {
  width: 3rem;
  height: 0.36rem;
  background: url("../../static/images/sb_a.png") no-repeat;
  background-size: 100% 100%;
}
.monitor-item-text {
  margin-left: 0.1rem;
}
#container {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
}
.right {
  position: absolute;
  top: 0.9rem;
  right: 0.1rem;
  z-index: 999;
  width: 3.2rem;
}
.env-dv {
  width: 3.2rem;
  height: 2.4rem;
  background: rgba(33, 64, 105, 0.6);
  display: flex;
}
.env-dv-left {
  margin: 0 0.15rem;
  width: 1rem;
  height: 2.1rem;
  padding: 0.12rem 0;
}
.env-item {
  width: 1rem;
  height: 1rem;
  border: 1px solid #1b5b95;
  position: relative;
}
.env-icon {
  margin-left: 0.05rem;
  width: 0.8rem;
  height: 0.9rem;
  background: url("../../static/images/cgy.png");
  background-size: 100% 100%;
}
.zy-icon {
  background: url("../../static/images/zy.png");
  background-size: 100% 100%;
}
.env-content {
  position: absolute;
  left: 0;
  top: 0.6rem;
  font-size: 0.1rem;
  color: white;
  width: 1rem;
  text-align: center;
}
.env-num {
  font-size: 0.2rem;
  font-weight: bold;
}
.env-dv-right {
  width: 1.75rem;
  height: 2.1rem;
  padding: 0.12rem 0;
}
.env-right-item {
  width: 1.75rem;
  height: 0.67rem;
  border: 1px solid #1b5b95;
  display: flex;
  align-items: center;
}
.env-right-icon {
  width: 0.54rem;
  height: 0.54rem;
  border: 0.01rem solid #1b5b95;
  margin-left: 0.05rem;
}
.sd-icon {
  background: url("../../static/images/sd.png");
  background-size: 100% 100%;
}
.wd-icon {
  background: url("../../static/images/wd.png");
  background-size: 100% 100%;
}
.fl-icon {
  background: url("../../static/images/fl.png");
  background-size: 100% 100%;
}
.env-right-content {
  margin-left: 0.1rem;
  width: 1rem;
  height: 0.52rem;
  font-size: 0.12rem;
  color: white;
}
.env-right-val {
  margin-top: 0.08rem;
}
.env-right-val span {
  font-size: 0.24rem;
  font-weight: bold;
}
.zbdl-dv {
  width: 3.2rem;
  height: 2.4rem;
  background: rgba(33, 64, 105, 0.6);
}
.zbdl-top {
  width: 3.2rem;
  height: 0.2rem;
  padding: 0.05rem 0;
  display: flex;
  justify-content: space-around;
}
.zbdl-top-item {
  width: 0.6rem;
  height: 0.2rem;
  line-height: 0.2rem;
  font-size: 0.13rem;
  color: white;
  text-align: center;
  border-radius: 0.05rem;
  background: rgba(58, 181, 255, 0.7);
  cursor: pointer;
}
.zbdl-actived {
  color: #ffbd29;
  font-weight: bold;
}
#zbdl {
  width: 3.2rem;
  height: 2rem;
}
#jxgl {
  width: 3.2rem;
  height: 2rem;
}
.sb-info {
  margin-top: 0.05rem;
  padding: 0.05rem 0 0.15rem;
  width: 3.2rem;
  background: rgba(2, 21, 53, 0.2);
}
.no-sb {
  height: 0.5rem;
  line-height: 0.5rem;
  padding-top: 0.15rem;
  font-size: 0.16rem;
  font-weight: 600;
  color: red;
  text-align: center;
}
.sb-info-item {
  width: 3.05rem;
  height: 0.2rem;
  line-height: 0.2rem;
  margin-top: 0.1rem;
  margin-left: 0.15rem;
  font-size: 0.14rem;
  color: white;
  display: flex;
}
.sb-info-title {
  width: 2.2rem;
  margin-right: 0.03rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-info-value {
  width: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  color: #ffc60c;
}
.sb-info-unit {
  text-align: center;
  width: 0.25rem;
  font-size: 0.1rem;
}
.foot {
  position: absolute;
  bottom: 0.1rem;
  left: 50%;
  height: 0.8rem;
  z-index: 999;
  width: 6.8rem;
  height: 0.5rem;
  display: flex;
  justify-content: space-between;
  transform: translateX(-3.4rem);
}
.foot-dv {
  position: absolute;
  bottom: 0.58rem;
  left: 50%;
  z-index: 999;
  width: 4.25rem;
  height: 0.2rem;
  transform: translateX(-50%);
  font-size: 0.15rem;
  color: #8598b1;
  opacity: 0.3;
  letter-spacing: 0.2em;
}
.alarm {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  z-index: 999;
  width: 18.9rem;
  height: 2.35rem;
  transform: translateX(-50%);
  animation: fadeIn 1.5s;
}
.alarm-bg {
  width: 18.9rem;
  height: 0.32rem;
  background: url("../../static/images/alarm_bg.png") no-repeat;
  background-size: 100% 100%;
}
.alarm-dv {
  width: 18.9rem;
  height: 1.9rem;
  margin-top: 0.1rem;
  background: rgba(30, 56, 97, 0.3);
}
.alarm-dv-content {
  width: 18.9rem;
  max-height: 1.5rem;
  overflow-y: auto;
}
.alarm-item {
  width: 18.3rem;
  height: 0.3rem;
  margin-top: 0.05rem;
  margin-left: 0.3rem;
  border-bottom: 1px solid #09476b;
  font-size: 0.15rem;
  color: white;
  display: flex;
  align-items: center;
}
.alarm-item-actived {
  border: 1px solid #ff3864;
  background-color: rgba(255, 56, 100, 0.15);
}
.alarm-title0 {
  width: 0.4rem;
}
.alarm-title1 {
  width: 2rem;
}
.alarm-title2 {
  padding-right: 1.07rem;
  width: 0.23rem;
  height: 0.26rem;
  background: url("../../static/images/alarm_title2_bg.png") no-repeat;
  background-size: 0.23rem 0.26rem;
}
.alarm-title3 {
  width: 2rem;
}
.alarm-title4 {
  width: 2rem;
}
.alarm-title5 {
  width: 4.4rem;
}
.alarm-title6 {
  width: 5.6rem;
}
.alarm-blue {
  padding-right: 1.07rem;
  width: 0.23rem;
  height: 0.26rem;
  background: url("../../static/images/alarm_blue_bg.png") no-repeat;
  background-size: 0.23rem 0.26rem;
}
.alarm-red {
  padding-right: 1.07rem;
  width: 0.23rem;
  height: 0.26rem;
  background: url("../../static/images/alarm_red_bg.png") no-repeat;
  background-size: 0.23rem 0.26rem;
}
.menu-item {
  width: 1.6rem;
  height: 0.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  background: url("../../static/images/menu.png") no-repeat;
  background-size: 100% 100%;
  cursor: pointer;
}
.menu-item-icon {
  width: 0.2rem;
  height: 0.2rem;
  margin-right: 0.1rem;
}
.menu-item-text {
  font-family: "PM-FONT";
  font-size: 0.22rem;
  color: white;
}
.menu-active {
  background: url("../../static/images/menu_a.png") no-repeat;
  background-size: 100% 100%;
}
.icon0 {
  background: url("../../static/images/zhzs.png") no-repeat;
  background-size: 100% 100%;
}
.icon1 {
  background: url("../../static/images/sbgl.png") no-repeat;
  background-size: 100% 100%;
}
.icon2 {
  background: url("../../static/images/gjgl.png") no-repeat;
  background-size: 100% 100%;
}
.icon3 {
  background: url("../../static/images/ksxj.png") no-repeat;
  background-size: 100% 100%;
}
.icon4 {
  background: url("../../static/images/afld.png") no-repeat;
  background-size: 100% 100%;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
</style>
